<script setup lang="ts">
import { RouterView, useRouter } from 'vue-router'
import { ref } from 'vue'
import {
  FileTextOutlined,
  ApartmentOutlined,
  SettingOutlined,
} from '@ant-design/icons-vue'

const router = useRouter()
const selectedKeys = ref<string[]>(['/'])

function handleMenuClick({ key }: { key: string }) {
  router.push(key)
  selectedKeys.value = [key]
}
</script>

<template>
  <div class="app-container">
    <a-menu
      v-model:selectedKeys="selectedKeys"
      mode="horizontal"
      @click="handleMenuClick"
      class="app-menu"
    >
      <a-menu-item key="/">
        <template #icon>
          <FileTextOutlined />
        </template>
        LOV使用演示
      </a-menu-item>
      <a-menu-item key="/cascade">
        <template #icon>
          <ApartmentOutlined />
        </template>
        LOV级联选择
      </a-menu-item>
      <a-menu-item key="/config">
        <template #icon>
          <SettingOutlined />
        </template>
        LOV配置管理
      </a-menu-item>
    </a-menu>

    <div class="app-content">
      <RouterView />
    </div>
  </div>
</template>

<style scoped>
.app-container {
  height: 100vh;
  background: #f0f2f5;
  width: 100vw;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.app-menu {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  flex-shrink: 0;
}

.app-content {
  flex: 1;
  overflow-y: auto;
  padding: 0;
  margin: 0;
}
</style>

